<?php
/**
 * BageCMS KindEditor Widget
 *
 * @author        shuguang <5565907@qq.com>
 * @copyright     Copyright (c) 2007-2013 bagesoft. All rights reserved.
 * @link          http://www.bagecms.com
 * @package       BageCMS.Widget
 * @license       http://www.bagecms.com/license
 * @version       v1.0.0
 */

class KindEditorSmall extends CInputWidget{
	public $language = 'zh_CN';

	/**
	 * 获获资源文件路径
	 *
	 * @return [type] [description]
	 */
	public function getAssetsPath() {
		$baseDir = dirname( __FILE__ );
		return Yii::app()->getAssetManager()->publish( $baseDir.DIRECTORY_SEPARATOR.'assets' );
	}


	/**
	 * 运行
	 */
	public function run() {
		parent::run();
		$assets = $this->getAssetsPath();
		$clientScript = Yii::app()->getClientScript();
		$clientScript->registerCssFile( $assets.'/themes/default/default.css' );
		$clientScript->registerScriptFile( $assets.'/kindeditor-min.js', CClientScript::POS_END );
		$clientScript->registerScriptFile( $assets.'/lang/'.$this->language.'.js', CClientScript::POS_END );
	}
}
?>
